<template>
  <header>
    <heads></heads>
  </header>
  <nav>
    <leftNav></leftNav>
  </nav>
  <main>
    <router-view></router-view>
  </main>
  <footer>
    <foot></foot>
  </footer>
</template>

<script lang="ts">
import { defineComponent, reactive, toRefs } from "vue";
import leftNav from "@/components/AdminLeft.vue";
import heads from "@/components/AdminHead.vue";
import foot from "@/components/AdminFooter.vue";
import axios from "axios";
import { myStore } from "@/stores/bigFruit";
import { useRouter } from "vue-router";
export default defineComponent({
  name: "AdminHome",
  components: { leftNav, heads, foot },
  setup() {
    let store = myStore();
    let router = useRouter();

    axios
      .post("http://tp.linqiaoyan.top/index.php/admin/isLogin", {
        token: store.userToken,
      })
      .then((response) => {
        if (response.data.status === 300) {
          router.push("/");
        }
      })
      .catch(() => {
        router.push("/");
      });
  },
});
</script>

<style scoped lang="scss">
nav {
  height: 99vh;
  width: 50px;
  position: fixed;
  color: white;
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
}
</style>
